//
// Created by Administrator on 2025/3/18.
//

#include "cc_screen_common.h"
lv_obj_t * ui_word_query_top_panel_component(lv_obj_t * parent){
    comp_obj_prop_t top_panel_prop_list[] = {
            {.type=COMP_OBJ_IMAGE,.img_dsc=&left_arrow_10_18_img},
    };
    lv_obj_t *top_panel = ui_create_row_list_panel(parent, lv_disp_get_hor_res(NULL),30,sizeof(top_panel_prop_list)/sizeof(comp_obj_prop_t),
                                                   top_panel_prop_list);
    lv_obj_set_style_border_side(top_panel,LV_BORDER_SIDE_BOTTOM,0);
    lv_obj_set_style_border_width(top_panel, 1, 0);
    // left padding 8 元素列间距7 ，左对齐
    lv_obj_set_style_pad_left(top_panel, 8,0);
    lv_obj_set_style_pad_column(top_panel, 7, 0);
    lv_obj_set_flex_align(top_panel,LV_FLEX_ALIGN_START,LV_FLEX_ALIGN_CENTER,LV_FLEX_ALIGN_CENTER);

    // 返回label
//    lv_obj_t *top_return_panel = ui_create_without_flex_panel(top_panel, 32, 22);
    lv_obj_t *top_return_panel = ui_create_without_flex_panel(top_panel, 32, 26);

    lv_obj_t *top_return_label = ui_create_default_label(top_return_panel, "返回", CHINESE_FONT_16_LIGHT);

    return top_panel;
}

// 弹窗提示框
lv_obj_t * ui_prompt_dialog(lv_obj_t * parent, const char * title, lv_coord_t width,lv_coord_t height,lv_coord_t label_width,lv_font_t * font){
    lv_obj_t *dialog_panel = ui_create_without_flex_panel(parent, width, height);
    lv_obj_set_style_border_width(dialog_panel, 1, 0);
    lv_obj_set_style_border_side(dialog_panel, LV_BORDER_SIDE_FULL, 0);
    lv_obj_t *title_label = ui_create_default_label(dialog_panel, title, font);
    lv_obj_set_width(title_label, label_width);
    lv_label_set_long_mode(title_label, LV_LABEL_LONG_WRAP);
    lv_obj_set_style_text_align(title_label, LV_TEXT_ALIGN_CENTER, 0);
    return dialog_panel;
}
